﻿-- =============================================
-- Author:		Andreas Könighofer (IT-eXperience)
-- Create date: 15.01.2009
-- Description:	Deletes all rentalservices that match with the given parameters
-- =============================================
CREATE PROCEDURE [dbo].[DeleteRentalService] 
	-- Add the parameters for the stored procedure here
	@RentalServiceID INT = NULL
	, @StartDate SMALLDATETIME = NULL
	, @EndDate SMALLDATETIME = NULL
	, @ReturnedDate SMALLDATETIME = NULL
	, @ResourceID INT = NULL
	, @CustomerID INT = NULL
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	DELETE FROM RentalService
	WHERE ((@RentalServiceID IS NULL) OR (RentalServiceID = @RentalServiceID))
	AND ((@StartDate IS NULL) OR (StartDate = @StartDate))
	AND ((@EndDate IS NULL) OR (EndDate = @EndDate))
	AND ((@ReturnedDate IS NULL) OR (ReturnedDate = @ReturnedDate))
	AND ((@ResourceID IS NULL) OR (ResourceID = @ResourceID))
	AND ((@CustomerID IS NULL) OR (CustomerID = @CustomerID))
END

---- end script DeleteRentalService stored procedure ----

---- start script DeleteResource stored procedure ----

